package up_down_share.viewcontroller.coverviewpager;



import android.annotation.SuppressLint;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;

public class CustomViewPager extends ViewPager {
	
	// --------------------------------------------------
	// ----- constants -----
	// --------------------------------------------------
	
	// --------------------------------------------------
	// ----- properties -----
	// --------------------------------------------------
	private PageScrolledListener pagescrolledlistener = null;
	
	// --------------------------------------------------
	// ----- extends -----
	// --------------------------------------------------

	public CustomViewPager(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
	
	public CustomViewPager(Context context, AttributeSet  attr){
		super(context, attr);
		
	}
	
	@Override
	protected void onPageScrolled(int position, float offset, int offsetPixels){
		super.onPageScrolled(position, offset, offsetPixels);
	     
	       if(pagescrolledlistener != null)
	       {
	    	   pagescrolledlistener.onPageScrolled(this.getCurrentItem(), offsetPixels);
	       }
	    
	      
	}

	
	public void onPageScrolledUsed(){
		
	}
	// --------------------------------------------------
	// ----- functions -----
	// --------------------------------------------------
	
//	@SuppressLint("NewApi")
	//public void displayScrollX(){
		
		//System.out.println("Current ScrollX:"+this.getScaleX());
	//}
	
	public void setPageScrolledListener(PageScrolledListener plistener){
		
		pagescrolledlistener = plistener;
	}
}
